import java.util.*;

public class PalindromesSearch {

	/**
	 * Chapter 1 program 2: Searching for Plaindroms
	 * String entered via keyboard is split and then
	 *each substring is compared to it's reversed instance
	 * @author Vladimir Beliy
	 */
	public static void main(String[] args) {
	
	String string=inputString();
	IfElseMethod (string);
	
	}
	
	/**
	 * IfElseMethod 
	 * @param string
	 */
	public static void IfElseMethod (String string){
		if (2>string.length()){
			System.out.println("Length of string does not allow to search for palindroms");
		}
	else{
		String [] array=splitSubstrings(string);
		int nOfSubstrings=countSubstrings(splitSubstrings(string));
		loopingMethod (nOfSubstrings, array);
		}
	}
	
	/**
	 * loopingMethod method 
	 * @param nOfSubstrings, array
	 */
	public static void loopingMethod (int nOfSubstrings, String [] array){
		for (int i=0; i < nOfSubstrings; i++){
			String subString = getSubString (array, i);
			String reversedSubstring=getReversedSubString (subString);
			outputMethod(i, subString, reversedSubstring);
			}
	}
	
	/**
	 * getSubString method returns substrings created form elements of array
	 * @param array, i
	 * @return subString
	 */
	public static String getSubString (String[] array, int i){
		String subString=array[i];		
		return subString;
	}
	
	/**
	 * getReversedSubString method reversed substrings
	 * @param subString
	 * @return reversedSubstring 
	 */
	public static String getReversedSubString (String subString){
		StringBuffer buffer = new StringBuffer(subString).reverse();
		String reversedSubstring = buffer.toString();
		return reversedSubstring;
	}
			
	/**
	 * outputMethod prints result of  searching
	 */
	public static void outputMethod(int i, String subString, String reversedSubstring){
		if (subString.length()>2 && subString.equals(reversedSubstring)){
			System.out.printf("%d yes -> %s\n", i, subString);
		}
		else
			System.out.printf("%d none\n", i);
	}
	
	/**
	 * inputString method returns input via keyboard string
	 * @return message
	 */
	public static String inputString(){
		System.out.println("Input your string, using space as delimeter:");
		Scanner scanner=new Scanner(System.in);
		String message =scanner.nextLine();
		scanner.close();
		return message;
	}
	
	/**
	 * splitAndCountSubstrings method splits string using space as delimiter
	 * @param string
	 * @return array
	 */
	public static String[] splitSubstrings (String string){
		String [] array=string.toLowerCase().split(" ");
		return array;
	}

	/**
	 * splitAndCountSubstrings method returns number of substrings created
	 * @param string
	 * @return nStrings
	 */
	public static int countSubstrings (String[] array){
		int nSubstrings=array.length;
		System.out.printf("Your string contains %d substrings,  " +
				"\namong which there are palindromes in:\n", nSubstrings);
		return nSubstrings;
	}
}